#!/usr/bin/env python
PACKAGE = "mrs_circle_flier"

import roslib;
roslib.load_manifest(PACKAGE)

from dynamic_reconfigure.parameter_generator_catkin import *

gen = ParameterGenerator()

publish_mode_enum = gen.enum([gen.const("Topic", int_t, 0, "Topic"),
                           gen.const("Service", int_t, 1, "Service")],
                           "Publish mode")

publisher = gen.add_group("Publisher");

publisher.add("publisher_rate", double_t, 0, "Publisher rate [Hz]", 0.0, 0.1, 500.0)
publisher.add("publisher_mode", int_t, 0, "Publish mode", 0, 0, 1, edit_method=publish_mode_enum)
publisher.add("publisher_active", bool_t, 0, "Publisher active? [true/false]", False)

trajectory_params = gen.add_group("Trajectory parameters");

direction_enum = gen.enum([gen.const("CW", int_t, 0, "ClockWise"),
                           gen.const("CCW", int_t, 1, "CounterClockWise")],
                           "Direction")

trajectory_params.add("dt", double_t, 0, "Sample time [s]", 0.0, 0.01, 10.0)
trajectory_params.add("n_points", int_t, 0, "Number of points [-]", 0, 0, 10000)
trajectory_params.add("direction", int_t, 0, "Direction mode", 0, 0, 1, edit_method=direction_enum)

center = gen.add_group("Circle center");

center.add("frame_id", str_t, 0, "frame_id of the trajectory center", "")
center.add("center_x", double_t, 0, "x [m]", 0.0, -100.0, 100.0)
center.add("center_y", double_t, 0, "y [m]", 0.0, -100.0, 100.0)
center.add("center_z", double_t, 0, "z [m]", 0.0, 1.0, 20.0)

parameters = gen.add_group("Circle parameters");

orientation_enum = gen.enum([gen.const("horizontal", int_t, 0, "Horizontal"),
                                 gen.const("vertical", int_t, 1, "Vertical"),
                                 gen.const("combined", int_t, 2, "Combined"),
                                 gen.const("cycloid", int_t, 3, "Cycloid")],
                                 "Orientation")

parameters.add("radius", double_t, 0, "Circle radius [m]", 0.0, 0.0, 20.0)
parameters.add("speed", double_t, 0, "Tangential speed [m/s]", 0.0, 0.0, 10.0)
parameters.add("orientation", int_t, 0, "Orientation", 0, 0, 3, edit_method=orientation_enum)
parameters.add("cycloid_speed", double_t, 0, "Cycloid speed [m/s]", 0.0, 0.0, 10.0)

heading = gen.add_group("Heading parameters");

heading_enum = gen.enum([gen.const("Constant", int_t, 0, "Constant"),
                           gen.const("Tangent", int_t, 1, "Tangent"),
                           gen.const("Center", int_t, 2, "Center"),
                           gen.const("Rotating", int_t, 3, "Rotating")],
                           "Heading mode")

heading.add("use_heading", bool_t, 0, "Use heading? [true/false]", False)
heading.add("heading_mode", int_t, 0, "Heading mode", 0, 0, 3, edit_method=heading_enum)
heading.add("heading", double_t, 0, "Heading (heading mode == 0) [rad]", 0.0, -3.14, 3.14)
heading.add("heading_rate", double_t, 0, "Heading rate (heading mode == 3) [rad/s]", 0.0, -3.14, 3.14)

action = gen.add_group("Action");

action.add("fly_now", bool_t, 0, "Should fly? [true/false]", False)

exit(gen.generate(PACKAGE, "MrsCircleFlier", "mrs_circle_flier"))
